<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>

<!DOCTYPE html>
<html>
	<head>
		<title>签到管理</title>
		<meta name="decorator" content="default"/>
		<script type="text/javascript">     
			$(function(){ 
				var defHeight = 300,wh=$(window).height();
				var lh=$('.location').height(),fh=$('#floatHead').height(),sh=$('.det-list').height(),ph=$('.pagelist').height();
				defHeight = (wh-lh-fh-sh-ph-130);
				$('.flexgrid').flexigrid({striped:true,height:defHeight});
			});
			
			function page(n,s){
				$("#pageNo").val(n);
				$("#pageSize").val(s);
				$("#searchForm").submit();
	        	return false;
	        }
	        
	        function deleteAll(){
				var ids =[];//定义一个数组    
	            $('input[name="checkall"]:checked').each(function(){    
	                ids.push($.trim($(this).val()));
	            });
	            document.location.href='${ctx}/qd/siginin/delete?ids='+ids;
			}
		</script>
	</head>
	<body>
		<sys:message content="${message}"/>
		<!--导航栏-->
		<div class="location">
			<a href="javascript:history.back(-1);" class="back"><i></i><span>返回上一页</span></a>
			<a href="${ctx}/center" class="home"><i></i>
			<span>首页</span></a> 
			<i class="arrow"></i> 
			<span>签到管理</span>
		</div>
		<!--/导航栏-->

		<!--工具栏-->
		<div id="floatHead" class="toolbar-wrap">
			<div class="toolbar">
				<div class="box-wrap">
					<a class="menu-btn"></a>
					<div class="l-list">
						<ul class="icon-list">
							<li><a class="all" href="javascript:;" onclick="checkAll(this);"><i></i><span>全选</span></a></li>
							<shiro:hasPermission name="qd:siginin:add"><li><a class="add" href="${ctx}/qd/siginin/form"><i></i><span>新增</span></a></li></shiro:hasPermission>
							<shiro:hasPermission name="qd:siginin:delete"><li><a id="btnDelete" class="del" href="${ctx}/qd/siginin/delete?id=${siginin.id}" onclick="return confirma('确认要删除该签到吗？', deleteAll)"><i></i><span>删除</span></a></li></shiro:hasPermission>
						</ul>
					</div>
					<div class="r-list" style="display:none;">
						<input name="txtKeywords" type="text" id="txtKeywords" class="keyword" /> 
						<a id="lbtnSearch" class="btn-search" href="javascript:void(0)">查询</a>
					</div>
				</div>
			</div>
		</div>
		<!--/工具栏-->
		
		<!--搜索栏-->
		<form:form id="searchForm" modelAttribute="siginin" action="${ctx}/qd/siginin" method="post">
			<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
			<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
			<div class="det-list clearfix">
			    <div class="group btm">
					<div class="control">
			            <div class="title">学员编号</div>
			            <form:input path="student.id" htmlEscape="false" cssClass="input normal"/>
			        </div>
					<div class="control">
			            <div class="title">状态</div>
			           <div class="rule-single-select single-select"> 
				            <form:select path="state"  htmlEscape="false" cssClass="input normal">
					            <form:option value=""  selected="selected"  label="全部显示"/>
					             <form:option value="1"  label="签到"/>
					              <form:option value="-1"   label="旷课"/>
				            </form:select>
			            </div>
			        </div>
			        <div class="control">
			            <div class="title">学员姓名</div>
			            <form:input path="student.name" htmlEscape="false" cssClass="input normal"/>
			        </div>
			    </div>  <br/>
			    <div class="group btm">
			    <div class="control">
			            <div class="title">会员姓名</div>
			            <form:input path="member.name" htmlEscape="false" cssClass="input normal"/>
			        </div>
			        <div class="control">
			            <div class="title">会员手机号</div>
			            <form:input path="member.mobile" htmlEscape="false" cssClass="input normal"/>
			        </div>
			        <div class="control">
			            <div class="title">发生日期</div>
				            <div class="date-input">
				            	<i></i>
				            	<fmt:formatDate value="${siginin.startOn}" pattern="yyyy-MM-dd" var="startOn" />
				            	<form:input path="startOn"  onclick="WdatePicker({dateFmt:'yyyy-MM-dd'});" htmlEscape="false" cssClass="input" value="${startOn}" />&nbsp;&nbsp;&nbsp;~
				            </div>
			        	</div>
				         <div class="date-input">
				            <i></i>
				            <fmt:formatDate value="${siginin.endOn}" pattern="yyyy-MM-dd" var="endOn" />
				          	 <form:input path="endOn"  onclick="WdatePicker({dateFmt:'yyyy-MM-dd'});"  htmlEscape="false" cssClass="input" value="${endOn}" />
	          	 	</div>
			    </div> 
			    <br>
			     <div class="group btm">
			    <br>
			    <br>
			    <br>
          	 	</div>
			    <div class="group searchbtn">
			        <div class="btn-list">
			            <input type="submit" name="btnDetailedSearch" value="查询" id="btnDetailedSearch" class="btn">
			            <input name="btnReturn" type="reset" value="重置" class="btn yellow">
			        </div>
			    </div>
			    <div style="clear:both;"></div>
			</div>
		</form:form>
		<!--/搜索栏-->
		
		<!--列表-->
		<div class="table-container">
			<table class="flexgrid" style="text-align: center;">
				<thead>
					<tr>
						<th width="25">选择</th>
						<th width="100">操作</th>
						<th width="100">学员姓名</th>
						<th width="100">会员姓名</th>
						<th width="100">会员手机号</th>
						<th width="100">预约课程编号</th>
						<th width="100">处理时间</th>
						<th width="100">状态</th>
					</tr>
				</thead>
				<tbody>
					<c:forEach items="${page.list}" var="siginin">
					<tr>
						<td style="text-align:center;">
							<span class="checkall" style="vertical-align: middle;">
								<input type="checkbox" name="checkall" value="${siginin.id}" />
							</span> 
							<%-- <input type="hidden" name="checkall" value="${siginin.id}" /> --%>
						</td>
						
						<td align="center">
							<shiro:hasPermission name="qd:siginin:edit">
							<a href="${ctx}/qd/siginin/form?id=${siginin.id}">修改</a>
							</shiro:hasPermission>
							<shiro:hasPermission name="qd:siginin:delete">&nbsp;|&nbsp;
							<a href="${ctx}/qd/siginin/delete?id=${siginin.id}" onclick="return confirmx('确认要删除该签到吗？', this.href)">删除</a>
							</shiro:hasPermission>
						</td>
						<td>${siginin.student.name}</td>
						<td>${siginin.member.name}</td>
						<td>${siginin.member.mobile}</td>
						<td>${siginin.courseorderId}</td>
						<td><fmt:formatDate value="${siginin.signtime}" pattern="yyyy-MM-dd HH:mm"  /></td>
						<td><c:choose><c:when test="${siginin.state==0}">未到</c:when><c:when test="${siginin.state==1}">已签到</c:when><c:when test="${siginin.state==-1}">旷课</c:when><c:otherwise>请假</c:otherwise></c:choose></td>
					</tr>
					</c:forEach>
				</tbody>
			</table>
		</div>
		<!--/列表-->

		<!--内容底部-->
		<div class="line10"></div>
		<div class="pagelist">
			${page}
		</div>
		<!--/内容底部-->
	</body>
</html>
